package com.itheima.d3_collection_list;

import java.util.ArrayList;
import java.util.List;

public class ListTest1 {
    public static void main(String[] args) {
        //list
        List<String > list =new ArrayList<>();
        list.add("孙悟空");
        list.add("猪八戒");
        list.add("齐天大圣");
        list.add("沙悟净");

        System.out.println(list);

        list.add(2,"紫霞");
        System.out.println(list);

        System.out.println(list.remove(2));
        System.out.println(list);

        System.out.println(list.get(3));

        System.out.println(list.set(2,"唐僧"));
        System.out.println(list);
    }
}
